package model 
{
	import com.gaiaframework.api.Gaia;
	import com.gaiaframework.api.IXml;
	import flash.display.MovieClip;
	import flash.events.EventDispatcher;
	import flash.text.Font;
	import flash.utils.Dictionary;
	import model.Model;
	import pages.Pages;
	
	/**
	 * ...
	 * @author usual
	 */
	public class Model extends EventDispatcher 
	{
		private static var _instance:Model = new Model();
		public var uiData:XML;
		public var mapBackground:MovieClip;
		public function Model() 
		{
			if( _instance ) throw new Error( "Model can only be accessed through Model.instance()" );			
		}
		
		public static function get instance() : Model
		{
			return _instance;
		}

		public function traceAvailableFonts():void
		{
			var fonts:Array = Font.enumerateFonts();
			var font:Font;
			for (var i:int = 0; i < fonts.length; i++ ) {
				font = fonts[i];
				trace("# Found font : " +font.fontName, "("+font.fontStyle+")");
			}
		}
		
		public function getGa():String
		{
			return String(Gaia.api.getSiteXML().@ga);
		}
		public function getUiLabel(id:String):XML
		{
			if (uiData == null) uiData = IXml(Gaia.api.getPage(Pages.INDEX).assets.uiData).xml;
			return uiData.label.(@id == id)[0]
		}		
		
		
		
		
		
	}

}